<!--#Include File="Include.asp"--><%
'--------------------------------------
'Power By 方卡在线 @2010-2014 f02
'URL:http://www.fangka.net/
'EMail:admin@ifangka.com
'QQ:861118936
'版权所有 未经允许不得去除本版权信息
'--------------------------------------

Call CheckAdminType("0,1",UType)

Dim Fk_Module_Name,Fk_Module_SubTitle,Fk_Module_Keyword,Fk_Module_Description,Fk_Module_About,Fk_Module_InfoField,Fk_Module_Content
Dim FieldArr_Input,FieldArr_Editor,FieldArr_Upload,FieldArr_Select
Dim Field_Content,Field_Name,Field_Remark,Field_Label,Field_Help,Field_Type,Field_Option,Field_TypeName

MenuId=Clng(Request.QueryString("Menu"))
ModuleId=Clng(Request.QueryString("Module"))
Types=Clng(Request.QueryString("Type"))

If UShowModule="all" Then
	ULimit="all"
End If
Call CheckAdminLimit(ULimit,"v_"&ModuleId,0)

Sqlstr="Select Fk_Module_Model From [Fk_Module] Where Fk_Module_Id=" & ModuleId
Rs.Open Sqlstr,Conn,1,1
If Not Rs.Eof Then
	ModelId=Rs("Fk_Module_Model")
Else
	Rs.Close
		Call FKFun.ShowErr("菜单项不存在！",1)
End If
Rs.Close

Sqlstr="Select Fk_Model_Field From [Fk_Model] Where Fk_Model_Id=" & ModelId
Rs.Open Sqlstr,Conn,1,1
If Not Rs.Eof Then
	ModelField=Rs("Fk_Model_Field")
Else
	Rs.Close
	Call FKFun.ShowErr("模型不存在！",1)
End If
Rs.Close

Select Case Types
	Case 1
		Call ModuleInfoEdit() '信息菜单项修改
	Case 2
		Call ModuleInfoEditDo() '信息菜单项修改执行
	Case Else
		Call FKFun.ShowErr("未发现功能项！",1)
End Select

'==========================================
'函 数 名：ModuleInfoEdit()
'作    用：信息菜单项修改
'==========================================
Sub ModuleInfoEdit()
	Sqlstr="Select Fk_Module_Id,Fk_Module_Name,Fk_Module_SubTitle,Fk_Module_Keyword,Fk_Module_Description,Fk_Module_About,Fk_Module_InfoField,Fk_Module_Content From [Fk_Module] Where Fk_Module_Id=" & ModuleId
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		Fk_Module_Name=Rs("Fk_Module_Name")
		Fk_Module_SubTitle=Rs("Fk_Module_SubTitle")
		Fk_Module_Keyword=Rs("Fk_Module_Keyword")
		Fk_Module_Description=Rs("Fk_Module_Description")
		Fk_Module_About=Rs("Fk_Module_About")
		Fk_Module_InfoField=Rs("Fk_Module_InfoField")
		Fk_Module_Content=Rs("Fk_Module_Content")
	Else
		Rs.Close
		Call FKFun.ShowErr("菜单项不存在！",1)
	End If
	Rs.Close
	TempArr=Split(ModelField,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Type=FKFun.GetSub(Temp,"Field_Type:","|;|","")
			Select Case Field_Type
				Case "0"
					If FieldArr_Input="" Then
						FieldArr_Input=Temp
					Else
						FieldArr_Input=FieldArr_Input&"|FieldList|"&Temp
					End If
				Case "1"
					If FieldArr_Editor="" Then
						FieldArr_Editor=Temp
					Else
						FieldArr_Editor=FieldArr_Editor&"|FieldList|"&Temp
					End If
				Case "2"
					If FieldArr_Upload="" Then
						FieldArr_Upload=Temp
					Else
						FieldArr_Upload=FieldArr_Upload&"|FieldList|"&Temp
					End If
				Case "3"
					If FieldArr_Select="" Then
						FieldArr_Select=Temp
					Else
						FieldArr_Select=FieldArr_Select&"|FieldList|"&Temp
					End If
			End Select
		End If
	Next
%>
<form id="ModuleInfoEdit" name="ModuleInfoEdit" method="post" action="ModuleInfo.asp?Type=2&Menu=<%=MenuId%>&Module=<%=ModuleId%>" target="ajax" boxClose="1" showStr="信息修改成功！">
<div id="title"><%=Fk_Module_Name%>修改</div>
<div id="box">
	<table width="95%" id="t1" class="t" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="12%" height="30" align="right">标题：</td>
			<td width="88%">&nbsp;<input name="Fk_Module_Name" type="text" class="input" id="Fk_Module_Name" value="<%=Fk_Module_Name%>" /><span class="help" title="<p>标题，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
        <tr>
            <td height="30" align="right">副标题：</td>
            <td>&nbsp;<input name="Fk_Module_SubTitle" type="text" class="input" id="Fk_Module_SubTitle" value="<%=Fk_Module_SubTitle%>" /><span class="help" title="<p>副标题，请输入1-50个字符（1个汉字为2个字符）。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">关键字：</td>
            <td>&nbsp;<input name="Fk_Module_Keyword" type="text" class="input" id="Fk_Module_Keyword" value="<%=Fk_Module_Keyword%>" size="50" /><span class="help" title="<p>多个关键字用英文逗号隔开，用于页面meta的keywords，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">描述：</td>
            <td>&nbsp;<input name="Fk_Module_Description" type="text" class="input" id="Fk_Module_Description" value="<%=Fk_Module_Description%>" size="50" /><span class="help" title="<p>请输入一段文字描述，用于页面meta的description，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
        </tr>
<%
	TempArr=Split(FieldArr_Input,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Field_Content=FKFun.GetSub(Fk_Module_InfoField,Field_Label&"_Field_Get:","|Get_Field_Line|","")
			Call FKFun.GetField_Input(Field_Name,Field_Label,Field_Help,Field_Content)
		End If
	Next
	TempArr=Split(FieldArr_Select,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Field_Option=FKFun.GetSub(Temp,"Field_Option:","|;|","")
			Field_Content=FKFun.GetSub(Fk_Module_InfoField,Field_Label&"_Field_Get:","|Get_Field_Line|","")
			Call FKFun.GetField_Select(Field_Name,Field_Label,Field_Help,Field_Option,Field_Content)
		End If
	Next

	TempArr=Split(FieldArr_Upload,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Field_Content=FKFun.GetSub(Fk_Module_InfoField,Field_Label&"_Field_Get:","|Get_Field_Line|","")
			Call FKFun.GetField_Upload(Field_Name,Field_Label,Field_Help,Field_Content)
		End If
	Next
%>
        <tr>
            <td height="30" align="right">内容：</td>
            <td>
<%
	If Fk_Site_Editor=0 Then
%>
				<textarea name="Fk_Module_Content" id="Fk_Module_Content" class="xheditor" rows="20" style="width:100%;"><%=Fk_Module_Content%></textarea>
<%
	ElseIf Fk_Site_Editor=1 Then
%>
				<textarea name="Fk_Module_Content" id="Fk_Module_Content" class="ueditor" style="width:740px;height:300px;"><%=Fk_Module_Content%></textarea>
				<script type="text/javascript">  
					UE.getEditor('Fk_Module_Content');
				</script>
<%
	End If
%>
			</td>
        </tr>
<%
	TempArr=Split(FieldArr_Editor,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Field_Content=FKFun.GetSub(Fk_Module_InfoField,Field_Label&"_Field_Get:","|Get_Field_Line|","")
			Call FKFun.GetField_Editor(Field_Name,Field_Label,Field_Help,Field_Content)
		End If
	Next
%>
	</table>
</div>
<div id="bottom">
	<input type="hidden" name="Id" value="<%=ModuleId%>" />
	<input type="submit" class="button" name="Enter" id="Enter" value="设 置" />
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
</form>
<%
End Sub

'==========================================
'函 数 名：ModuleInfoEditDo()
'作    用：信息菜单项修改执行
'==========================================
Sub ModuleInfoEditDo()
	Fk_Module_Name=FKFun.HTMLEncode(Trim(Request.Form("Fk_Module_Name")))
	Fk_Module_SubTitle=FKFun.HTMLEncode(Trim(Request.Form("Fk_Module_SubTitle")))
	Fk_Module_Keyword=FKFun.HTMLEncode(Trim(Request.Form("Fk_Module_Keyword")))
	Fk_Module_Description=FKFun.HTMLEncode(Trim(Request.Form("Fk_Module_Description")))
	Fk_Module_Content=FKFun.EditorImgTry(Request.Form("Fk_Module_Content"))
	Call FKFun.JsonString(Fk_Module_Name,1,50,0,"请输入标题！","标题不能大于50个字符！")
	Call FKFun.JsonString(Fk_Module_SubTitle,1,50,2,"请输入副标题！","副标题不能大于50个字符！")
	Call FKFun.JsonString(Fk_Module_Keyword,1,255,2,"请输入关键字！","关键字不能大于255个字符！")
	Call FKFun.JsonString(Fk_Module_Description,1,255,2,"请输入描述！","描述不能大于255个字符！")
	Call FKFun.JsonString(Fk_Module_Content,1,50,1,"请输入内容！","内容不能大于50个字符！")
	TempArr=Split(ModelField,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Type=FKFun.GetSub(Temp,"Field_Type:","|;|Field_Option:","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|Field_Help:","")
			If Field_Type="2" Then
				Field_Content=FKFun.EditorImgTry(Trim(Request.Form("Fk_Field_"&Field_Label&"")))
				Field_Content=Replace(Field_Content,"'","&#39;")
			Else
				Field_Content=FKFun.HTMLEncode(Trim(Request.Form("Fk_Field_"&Field_Label&"")))
			End If
			Field_Content=Replace(Field_Content,"_Field_Get:","&nbsp;_Field_Get")
			Field_Content=Replace(Field_Content,"Get_Field_Line:","&nbsp;Get_Field_Line")
			Fk_Module_InfoField=Fk_Module_InfoField&Field_Label&"_Field_Get:"&Field_Content&"|Get_Field_Line|"
		End If
	Next
	Sqlstr="Select Fk_Module_Id,Fk_Module_Name,Fk_Module_SubTitle,Fk_Module_Keyword,Fk_Module_Description,Fk_Module_InfoField,Fk_Module_Content From [Fk_Module] Where Fk_Module_Id=" & ModuleId
	Rs.Open Sqlstr,Conn,1,3
	If Not Rs.Eof Then
		Application.Lock()
		Rs("Fk_Module_Name")=Fk_Module_Name
		Rs("Fk_Module_SubTitle")=Fk_Module_SubTitle
		Rs("Fk_Module_Keyword")=Fk_Module_Keyword
		Rs("Fk_Module_Description")=Fk_Module_Description
		Rs("Fk_Module_InfoField")=Fk_Module_InfoField
		Rs("Fk_Module_Content")=Fk_Module_Content
		Rs.Update()
		If Fk_Site_Html=2 Then
			Sqlstr="Update [Fk_Module] Set Fk_Module_ToHtml=1 Where Fk_Module_Id=" & ModuleId
			Conn.Execute(Sqlstr)
		End If
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("要修改的菜单项不存在！")
	End If
	Rs.Close
End Sub

Call FKFun.PageEnd()
%>
